package ce.com.cenewbluesdk.scan;

import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.os.Handler;

/**
 * Created by Administrator on 2016/11/8 0008.
 */
public abstract class CEScanDevBase {

    public Context mContext;
    public Handler handler;

    public interface FindBlueTooth {
        public void findDev(BluetoothDevice device, int rssi, byte[] scanRecord);
    }

    public FindBlueTooth findDev;

    public CEScanDevBase(Context context, FindBlueTooth findDev) {
        this.mContext = context;
        this.findDev = findDev;
    }

    public abstract void startScan();

    public abstract void stopScan();
    public abstract boolean isBleEnabled();


    /**
     * 每发现一个设备，需要调用一次这个方法
     *
     * @param device
     * @param rssi
     * @param scanRecord
     */
    public void findDev(BluetoothDevice device, int rssi, byte[] scanRecord) {
        if (findDev != null) {
            findDev.findDev(device, rssi, scanRecord);
        }
    }

    public void setHandler(Handler handler) {
        this.handler = handler;
    }
}

